<?php

/**
 * @author Laurent SITTLER <lolo.sittler@gmail.com>
 * @author Alexandre GOMEZ <gomez.alexandre02@gmail.com>
 * @version 0.1
 */
require_once 'Model/User_Model.php';
require_once 'Model/Database_Model.php';
require_once 'User.php';
require_once 'DB.php';

/**
 * Araine Class
 */
class Ariane {

    /**
     * Constructor
     */
    function __construct() {
        $this->m_user = new User();
        $this->m_database = new DB();
        $this->m_filDB = NULL;
        $this->Load();
    }

    /**
     * Load elements
     */
    private function Load() {
        //$this->m_user = User_Model::GetUserById(Session::Get(Constants::$SESSION_cuser));
        $muser = new User_Model();
        $this->m_user = $muser->GetUserById(Session::Get(Constants::$SESSION_cuser));

        if (Session::Get(Constants::$SESSION_cdb) != NULL){
            $cdb = new Database_Model();
            $this->m_database = $cdb->GetById(Session::Get(Constants::$SESSION_cdb));
            $this->m_filDB = ' <span>&raquo;</span> ' . $this->m_database->GetNickname();
        }
    }

    /**
     * Show the ariane fil
     */
    public function Show() {
        include 'View/popup_profil.php';
        echo '<div id="iUser">&nbsp;</div><button id="edit-profil">' . $this->m_user->GetLogin() . '</button>' . $this->m_filDB;
    }

    /**
     * User connected
     * @var User
     */
    private $m_user;

    /**
     * database selected
     * @var String
     */
    private $m_database;
    
    /**
     * Show Database NickNmae
     * @var String 
     */
    private $m_filDB;

}